//
//  YHYMyCaseViewController.m
//  Home
//
//  Created by 杨泓晔 on 16/4/22.
//  Copyright © 2016年 LanJue. All rights reserved.
//

#import "YHYMyCaseViewController.h"

@interface YHYMyCaseViewController ()
@property (nonatomic,retain)UIImageView *BackimageView;
@property (nonatomic,retain)UIImageView *myImageView;
@property (nonatomic,retain)UILabel *nameL;
@property (nonatomic,retain)UILabel *priceL;
@property (nonatomic,retain)UILabel *sizeL;
@property (nonatomic,retain)UILabel *styleL;
@property (nonatomic,retain)UILabel *addressL;
@property (nonatomic,retain)UIButton *button;

@end

@implementation YHYMyCaseViewController
- (void)viewWillAppear:(BOOL)animated {
    
    self.navigationController.navigationBarHidden = NO;
    self.title = @"个人信息";
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //    左侧的图标
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(Back:)];
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = LV;
    self.BackimageView = [UIImageView new];
    [self.view addSubview:self.BackimageView];
    self.BackimageView.backgroundColor = [UIColor whiteColor];
    [self.BackimageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(16 / 2 * AUTO_HEIGHT);
        make.left.mas_equalTo(16/2 * AUTO_WIDTH);
        make.right.mas_equalTo(- 16/2 * AUTO_WIDTH);
        make.height.mas_equalTo(365 * AUTO_HEIGHT);
        
    }];
    self.BackimageView.layer.masksToBounds = YES;
    self.BackimageView.layer.cornerRadius = 5 * AUTO_WIDTH;
    
    
    _myImageView = [UIImageView new];
    [self.BackimageView addSubview:_myImageView];
    _myImageView.image = [UIImage imageNamed:@"u=957005295,3708602591&fm=206&gp=0.jpg"];
    [_myImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.BackimageView.mas_top).offset(7 * AUTO_HEIGHT);
        make.left.mas_equalTo(self.BackimageView.mas_left).offset(7 * AUTO_WIDTH);
        make.right.mas_equalTo(self.BackimageView.mas_right).offset(- 7 * AUTO_WIDTH);
        make.height.mas_equalTo(210 * AUTO_HEIGHT);
        
    }];
    
    
    _nameL = [UILabel new];
    _nameL.text = @"湖滨花园";
    _nameL.textColor = GH;
    _nameL.font = [UIFont fontWithName:TFont size:TEXTNAMEFONT * AUTO_WIDTH];
    [self.BackimageView addSubview:_nameL];
    [_nameL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_myImageView.mas_bottom).offset(5 * AUTO_HEIGHT);
        make.centerXWithinMargins .mas_equalTo(self.BackimageView);
        make.height.mas_equalTo(70/2 * AUTO_HEIGHT);
    
    }];
    
    UIImageView *line = [UIImageView new];
    [self.BackimageView addSubview:line];
    line.image = [UIImage imageNamed:@"虚线"];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_nameL.mas_bottom).offset(5 * AUTO_HEIGHT);
        make.left.mas_equalTo((14  )* AUTO_WIDTH);
        make.right.mas_equalTo(- (14) * AUTO_WIDTH);
        make.height.mas_equalTo(1.5 * AUTO_HEIGHT);
        
    }];
    
    //钱
    UIImageView *priceImageView = [UIImageView new];
    priceImageView.image = [UIImage imageNamed:@"qiang2x"];
    [self.BackimageView addSubview:priceImageView];
    [priceImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(36 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(15 * AUTO_WIDTH, 15 * AUTO_WIDTH));
        
    }];
    
    UIImageView *suxian1 = [UIImageView new];
    [self.BackimageView addSubview:suxian1];
    suxian1.image = [UIImage imageNamed:@"虚线竖"];
    [suxian1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.mas_equalTo(85 * AUTO_WIDTH);
        make.bottom.mas_equalTo(self.BackimageView.mas_bottom).offset(- 30 * AUTO_HEIGHT);
    }];
    
    _priceL = [UILabel new];
    _priceL.text = @"30";
    _priceL.textColor = ZI;
    _priceL.textAlignment = NSTextAlignmentCenter;
    _priceL.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    [self.BackimageView addSubview:_priceL];
    [_priceL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(priceImageView.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.height.mas_equalTo(priceImageView);
        make.left.mas_equalTo(self.BackimageView);
        make.right.mas_equalTo(suxian1.mas_right);
        
        
    }];
    
    

    //平方
    UIImageView *PingFangImageView = [UIImageView new];
    PingFangImageView.image = [UIImage imageNamed:@"pingfang"];
    [self.BackimageView addSubview:PingFangImageView];
    [PingFangImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(suxian1.mas_right).offset(35 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(15 * AUTO_WIDTH, 15 * AUTO_WIDTH));
        
    }];
    

    
    UIImageView *suxian2 = [UIImageView new];
    [self.BackimageView addSubview:suxian2];
    suxian2.image = [UIImage imageNamed:@"虚线竖"];
    [suxian2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.mas_equalTo(85 *2* AUTO_WIDTH);
        make.bottom.mas_equalTo(self.BackimageView.mas_bottom).offset(- 30 * AUTO_HEIGHT);
    }];
    _sizeL = [UILabel new];
    _sizeL = [UILabel new];
    _sizeL.text = @"110";
    _sizeL.textColor = ZI;
    _sizeL.textAlignment = NSTextAlignmentCenter;
    _sizeL.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    [self.BackimageView addSubview:_sizeL];
    [_sizeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(PingFangImageView.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.height.mas_equalTo(priceImageView);
        make.left.mas_equalTo(suxian1);
        make.right.mas_equalTo(suxian2.mas_right);
        
        
    }];
    
    
    UIImageView *homeIV = [UIImageView new];
    [self.BackimageView addSubview:homeIV];
    homeIV.image = [UIImage imageNamed:@"fangwu"];
    [homeIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(suxian2.mas_right).offset(33 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(18 * AUTO_WIDTH, 18 * AUTO_WIDTH));

    }];
    

    
    UIImageView *suxian3 = [UIImageView new];
    [self.BackimageView addSubview:suxian3];
    suxian3.image = [UIImage imageNamed:@"虚线竖"];
    [suxian3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.mas_equalTo(85 * 3* AUTO_WIDTH);
        make.bottom.mas_equalTo(self.BackimageView.mas_bottom).offset(- 30 * AUTO_HEIGHT);
    }];
    
    
   
    _styleL = [UILabel new];
    _styleL = [UILabel new];
    _styleL.text = @"平层户型";
    _styleL.textColor = ZI;
    _styleL.textAlignment = NSTextAlignmentCenter;
    _styleL.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    [self.BackimageView addSubview:_styleL];
    [_styleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(PingFangImageView.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.height.mas_equalTo(priceImageView);
        make.left.mas_equalTo(suxian2);
        make.right.mas_equalTo(suxian3.mas_right);
        
        
    }];
    
    
    UIImageView *addressIV = [UIImageView new];
    [self.BackimageView addSubview:addressIV];
    addressIV.image = [UIImage imageNamed:@"fenge"];
    [addressIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(suxian3.mas_right).offset(35 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(15 * AUTO_WIDTH, 15 * AUTO_WIDTH));

        
    }];
    
    _addressL = [UILabel new];
    _addressL = [UILabel new];
    _addressL = [UILabel new];
    _addressL.text = @"地中海";
    _addressL.textColor = ZI;
    _addressL.textAlignment = NSTextAlignmentCenter;
    _addressL.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];

    [self.BackimageView addSubview:_addressL];
    [_addressL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(PingFangImageView.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.height.mas_equalTo(priceImageView);
        make.left.mas_equalTo(suxian3);
        //make.right.mas_equalTo(suxian3.mas_right);
        make.right.mas_equalTo(self.BackimageView);

        
    }];
    
    
    
    
    
    
    //下一步
    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
    self.button.backgroundColor = GH;
    self.button.layer.masksToBounds = YES;
    self.button.layer.cornerRadius = 5;
    [self.button setTitle:@"收藏" forState:UIControlStateNormal];
    [self.button addTarget:self action:@selector(goNext:) forControlEvents:UIControlEventTouchUpInside];
    [self.button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    // [self.button setTitleColor:HS forState:UIControlStateNormal];
    self.button.frame = CGRectMake(50.00*AUTO_WIDTH, 600.00*AUTO_WIDTH, 275.00*AUTO_WIDTH, 40.00*AUTO_WIDTH);
    self.button.titleLabel.font = [UIFont fontWithName:@"Arial" size:TEXTCONTENTFONT2 * TEXTWEIGHT];
    [self.view addSubview:_button];
    
    [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_BackimageView.mas_bottom).offset(50 * AUTO_HEIGHT);
        //make.center.equalTo(self);
        make.centerXWithinMargins.mas_equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH - 100 * AUTO_WIDTH, 40 * AUTO_HEIGHT));
    }];

    
    UIImageView *lineBottom = [UIImageView new];
    [self.BackimageView addSubview:lineBottom];
    lineBottom.image = [UIImage imageNamed:@"虚线"];
    [lineBottom mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(suxian1.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.width.height.mas_equalTo(line);
        
    }];
    
    
    
}


- (void)goNext:(UIButton *)save{
    NSString *title = NSLocalizedString(@"提示", nil);
    NSString *message = NSLocalizedString(@"确认收藏", nil);
    NSString *cancelButtonTitle = NSLocalizedString(@"取消", nil);
    NSString *otherButtonTitle = NSLocalizedString(@"确认", nil);
    
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
    
    // Create the actions.
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
        // NSLog(@"The \"Okay/Cancel\" alert's cancel action occured.");
    }];
    
    UIAlertAction *otherAction = [UIAlertAction actionWithTitle:otherButtonTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
        //  NSLog(@"The \"Okay/Cancel\" alert's other action occured.");
      //  [self.navigationController popViewControllerAnimated:YES];
          }];
    
    // Add the actions.
    [alertController addAction:cancelAction];
    [alertController addAction:otherAction];
    
   [self presentViewController:alertController animated:YES completion:nil];
    

}
-(void)Back:(UIButton *) goback
{
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
